<template>
  <div class="renking">
      <div class="toDay">{{title}}</div>
      <div class="list">
        <ul>
          <li class="top">
            <span class="num">排名</span>
            <span class="name">用户名称</span>
            <span class="number">积分</span>
          </li>
          <vLoading v-if="!static"></vLoading>
          <li v-if="static" v-for="(item,index) in date">
            <span class="num"><i>{{index+1}}</i></span>
            <span class="name">{{item.data.nickname}}</span>
            <span class="number">{{item.data.integral_count}}</span>
          </li>
        </ul>
      </div>
  </div>
</template>

<script>
import {Get,Post,Put,Del} from '@/api/index.js'
import vLoading from '@/components/Loading.vue'

export default {
  name: 'renking',
  data () {
    return {
      static:false,
      title:'积分排行榜',
      date:''
    }
  },
  components:{
    vLoading
  },
  mounted(){
    this.getData()
  },
  methods:{
    getData(){
      let that=this
      Get('/users?_sort=-integral_count',this.$store.state.token).then(function(reg){
        that.date=reg.data
        that.static=true
      })
    }
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>

</style>
